package cn.tedu.jdbc;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Collection;

public class HomeWork2 {
    public static void main(String[] args) {
        Connection c=null;
        PreparedStatement p=null;
        ResultSet r =null;
        try {
            c= JDBCUtils2.get();
            String sql="select * from user ";
            p = c.prepareStatement(sql);
             r = p.executeQuery();
             while (r.next()){
                 Object r1 = r.getObject(1);
                 Object r2 = r.getObject(2);
                 Object r3 = r.getObject(3);
                 System.out.println(""+r1+r2+r3);
             }

        } catch (Exception e) {
            e.printStackTrace();
        }finally {
           JDBCUtils2.close(r,p,c);
        }
    }
}
